package com.XSQS.storage.index;



public class IndexBuffer {

	private static IndexEntry []indexEntries = null;
	private static InvertedWordItem []invertedWordItems = null;
	
	private static IndexBuffer instance;
	private InvertedReader reader;
	
	public IndexBuffer(){
		reader=InvertedReader.getInstance();
	}
	
	public synchronized static IndexBuffer getInstance() {
		if (instance == null) {
			instance = new IndexBuffer();
		}
		return instance;
	}
	
	public boolean isValidated(){
		if(indexEntries==null || invertedWordItems==null)
			return false;
		else
			return true;
	}

	/**
	 * @return the indexEntries
	 */
	public static IndexEntry[] getIndexEntries() {
		return indexEntries;
	}

	/**
	 * @param indexEntries the indexEntries to set
	 */
	public static void setIndexEntries(IndexEntry[] indexEntries) {
		IndexBuffer.indexEntries = indexEntries;
	}

	/**
	 * @return the invertedWordItems
	 */
	public static InvertedWordItem[] getInvertedWordItems() {
		return invertedWordItems;
	}

	/**
	 * @param invertedWordItems the invertedWordItems to set
	 */
	public static void setInvertedWordItems(InvertedWordItem[] invertedWordItems) {
		IndexBuffer.invertedWordItems = invertedWordItems;
	}
	
//	public void getIndexEntries(){
//		indexEntries = reader.readAllIndexEntries();
//	}
//	
//	public void getinvertedWordItems(){
//		invertedWordItems = reader.readAllInvertedWordItem();
//	}
	
}